package com.hps.spring.cloud.alibaba.dubbo.controller;

import com.hps.spring.cloud.alibaba.dubbo.entity.User;
import com.hps.spring.cloud.alibaba.dubbo.service.IUserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author heps
 * @since 2020/11/3 16:56
 */
@RestController
public class NacosDubboConsumerController {

  @Reference
  private IUserService userService;

  @GetMapping("/user/{id}")
  public User getByUser(@PathVariable("id") Long id) {
    return userService.getById(id);
  }
}
